package com.spring.cloud.client.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;

@Service
public class ConsumerService {

		
	@Autowired
	RestTemplate restTemplate;

	@HystrixCommand(fallbackMethod = "addServiceFallback")
	public String add( ) {
		return restTemplate.getForEntity("http://DIDISPACE/add?a=10&b=20", String.class).getBody();
	}
	
	private String addServiceFallback(){
		return "error";
	}
}
